import javax.swing.*;
import java.awt.*;
import javax.swing.event.*;
public class Win extends JFrame implements DocumentListener {
   JTextArea text1,text2;
   public Win() {
      setLayout(new GridLayout(2,2)); //【1】
      text1 = new JTextArea();
      text2 = new JTextArea();     //【2】
 JComponent jButton = new JButton();

      add(text1);
      text1.getDocument().addDocumentListener(this); //【3】
      setVisible(true);
      setBounds(500,400,2,3);          //【4】
      setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
   }
   public void changedUpdate(DocumentEvent e) {}
   public void removeUpdate(DocumentEvent e){}
   public void insertUpdate(DocumentEvent e){}
}